<?php

class Admin_StudentsController extends Zend_Controller_Action
{
	public function init()
	{
		/* Initialize action controller here */
	}
	public function indexAction()
	{
		$pp = new Admin_Model_Students();
		$this->view->grid=$pp->getList();
		// action body
		$form = new Admin_Form_Students();
		$form -> setAction('/admin/students/store');
		$this->view->form_stud = $form;
	}
	public function storeAction()
	{
		$form = new Admin_Form_Students();
		$this->view->form=$form;
		
		if($this->getRequest()->isPost()){
			$formData=$this->getRequest()->getPost();
			var_dump($formData);
			die;
			if($form->isValid($formData)){
				$data=$form->getValues();
				$obj=new Admin_Model_Students();
				var_dump($data);
				if(!empty($data['student_id'])){
					$obj->editStudent($data, $data['student_id']);
				}else{
					$obj->addStudent($data);
				}
			}
			else{
				var_dump(err);
				die;
				
			}
		}
		die;
	}
	public function deleteAction()
	{
	
		// action body
	}
	public function changeAction()
	{
	
		// action body
	}
}

